<%@page import="my.db.DTO.ArticleDTO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="my.db.DTO.AuthorDTO"%>
<%@ include file="sites/ad_header.jsp" %>
<%
	if(session.getAttribute("user")==null){
		response.sendRedirect("LoadIndex.jsp");
	}
%>
<div class="r-body">
	<div class="page-title">
		<p>Author Detail</p>
	</div>
	<div class="frm-action">
				<%
					AuthorDTO adto=(AuthorDTO)request.getAttribute("authordetail");
					ArrayList<ArticleDTO> lst_ardato=(ArrayList<ArticleDTO>)request.getAttribute("authordetailArticle");
					if(adto !=null || lst_ardato !=null){
				%>
					<form action="./addauthor.article" method="post" >
					<table border="0" cellpadding="10" >
						<tr>
							<td><a href="javascript:history.go(-1);"><img src="Image/go_back.png" class="go_back" title="Back to Main page"/></a></td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td>User ID</td>
							<td><input type="text" readonly="readonly" name="userID" class="userID" value="<%=adto.getAuthorID()%>" /></td>							
							<td>User Name</td>
							<td><input type="text" readonly="readonly" name="userName" class="userName" value="<%=adto.getAuthorName()%>"/></td>							
						</tr>
						<tr>
							<td>Gender</td>
							<td><input type="text" name="userGender" class="userGender" value="<%
										if(adto.getAuthorGender()==1){
											out.print("Female");
										}else{
											out.println("Male");
										}
									%>" />
							</td>							
							<td>Email</td>
							<td><input type="text" readonly="readonly" name="userMail" class="userMail" value="<%=adto.getAuthorMail()%>"/></td>							
						</tr>
						<tr>
							<td>Phone</td>
							<td><input type="text" readonly="readonly" name="userPhone" class="userID" value="<%=adto.getAuthorPhone()%>"/></td>							
							<td>Date</td>
							<td><input type="text" readonly="readonly" name="userDate" class="status" value="<%=adto.getAuthorDate()%>"/></td>							
						</tr>
					</table>
					
					<div class="grid-data" style="margin-top: 20px !important;">
					<table border="0" cellpadding="10" class="tb-data">
						<thead>
							<th>Book ID</th>
							<th>Book Title</th>
							<th>Book Type</th>
							<th>Date </th>
							<th>Detail</th>
						</thead>
						<tbody>
						<%
							for(int i=0;i<lst_ardato.size();i++){
								ArticleDTO a=lst_ardato.get(i);
						%>
						<tr>
							<td class="td-center" width="100">
								<%=a.getArticleNo() %>
							</td>
							
							<td>
								<%=a.getArticleTitle() %>
							</td>
							
							<td>
								<%=a.getArticleType().getTypeName() %>
							</td>
							
							<td class="td-center">
								<%=a.getArticleDate() %>
							</td>
						<script type="text/javascript">
								function article_detail(id){
									window.location.href="./ArticleDetail.article?articledetailid="+id+"";
								} 
						</script>
							<td class="td-center" width="150">
								<input onclick="article_detail(<%=a.getArticleNo()%>)" type="button"  value="Detail"   class="btn-default" style=""/>
							</td>
							
						</tr>
						<%	}
							}
						%>
							
						</tbody>
								
					</table>	
				</div>	<!-- End Grid-data -->
			<div class="pagination-panel" style="width:960px !important;">
				<div class="limit-row">
					<span>Totol Record: 40</span>
					<span>Page: 2/5</span>
					<span>Limit Row:</span>
					<select name="lemit_art_num" >
						<option value="5"> 5 </option>
						<option value="5"> 10 </option>
						<option value="5"> 15 </option>
						<option value="5"> 20 </option>
					</select>
				</div><!-- end p-siteleft -->
				<div class="pagination">
					<ul>
						<li><a href="#"> << </a></li>
						<li><a href="#"> < </a></li>
						<li><a href="#"> 1 </a></li>
						<li><a href="#"> 2 </a></li>
						<li><a href="#"> 3 </a></li>
						<li><a href="#"> 4 </a></li>
						<li><a href="#"> 5 </a></li>
						<li><a href="#"> > </a></li>
						<li><a href="#"> >> </a></li>
					</ul>
					<div class="go-page">
						<input type="text" class="go-to-page number"/>
						<input type="button" value=" GO "/>
					</div>
				</div>
			</div><!-- end pagination -->
	</form>
	
	
	
	
</div><!-- End r-body -->